<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        :root {
            /* 定义气泡弹出框背景色 */
            --poptipBg: #30363d;
            /* 弹出框字体颜色 */
            --color: #fff;
            /* 弹出框三角形边长 */
            --triangle: 8px;
            /* 弹出框与元素的偏移 */
            --distance: 70px;
        }

        .poptip {
            position: relative;
            z-index: 101;
        }

        .poptip::before,
        .poptip::after {
            visibility: hidden;
            /*指定一个元素是否是可见的。*/
            opacity: 0;
            transform: translate3d(0, 0, 0);
            /*3d转换*/
            transition: all 0.3s ease 0.2s;
            /*0.3：放上去0.3s后出现，0.2：持续时间*/
            box-sizing: border-box;
        }

        .poptip::before {
            content: "";
            position: absolute;
            width: 0;
            height: 0;
            border-style: solid;
            border-width: var(--triangle) var(--triangle) var(--triangle) 0;
            border-color: transparent var(--poptipBg) transparent transparent;
            left: calc(50% - var(--triangle));
            top: 0px;
            transform: translateX(850%) translateY(50%);
        }

        .poptip::after {
            font-size: 14px;
            color: var(--color);
            /* 内容为标签内的属性值 */
            content: attr(aria-controls);
            position: absolute;
            padding: 6px 12px;
            white-space: nowrap;
            writing-mode: tb-rl;
            z-index: -1;
            right: 62%;
            bottom: 218%;
            transform: translateX(315%) translateY(110%);
            background: var(--poptipBg);
            line-height: 1;
            border-radius: 2px;
        }

        .poptip:hover::before,
        .poptip:hover::after {
            visibility: visible;
            opacity: 1;
        }

        .btn {
            width: 100px;
            line-height: 1.5;
            padding: 5px 10px;
            color: #fff;
            background: #00adb5;
            border-radius: 4px;
            text-align: center;
            cursor: pointer;
            margin: 200px auto;
        }
    </style>
</head>

<body>
    <div class="poptip btn" aria-controls="弹出右边气泡">右边气泡提示</div>
</body>

</html>